<layout name="page" />
<block name="content">
	<style>
		td {
			white-space: nowrap
		}
		th {
			white-space: nowrap
		}
	</style>
	{:widget('page_header/adv_search',array('name'=>'工资查询','search'=>'M'))}
	<form method="post" name="form_adv_search" id="form_adv_search">
		<div class="x-panel hidden"  id="adv_search">
			<div class="x-panel-header">
				<h4>高级搜索</h4>
				<div class="split"></div>
				<a  class="btn" id="submit_adv_search">搜索</a>
				<a  class="btn btn-return" id="close_adv_search">关闭</a>
			</div>
			<div class="x-panel-body">
				<div class="frame">
					<div class="box col-12">
						
							<label class="input-label" for="eq_month">工资期间： </label>
							
								<input class="input" type="text" id="eq_month" name="eq_month">
							</div>
						</div>
					</div>
					<div class="box col-12">
						
							<label class="input-label" for="li_data"> 姓名： </label>
							
								<input class="input" type="text" id="li_data" name="li_data">
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</form>
	<if condition="$auth->read">
		<div class="operate-panel">
			<if condition="$auth->admin">
				<a class="btn btn-del" id="btn_del">删除</a>
			</if>
			<div class="split"></div>
			<if condition="$auth->read">
				<a class="btn  " onclick="setpwd();">设置密码</a>
			</if>
			<if condition="$auth->admin">
				<a class="btn" onclick="import_data()">导入</a>
			</if>
		</div>
	</if>
	<div class="ul-table message-container">
		<div style="overflow-x: scroll;overflow-y: hidden">
			<table class="table table-bordered">
				<thead>
					{$head_html}
				</thead>
				<if condition="!empty($list)">
					<tr class="no-data">
						<td colspan="34" class="text-center"><h3>没找到数据</h3></td>
					</tr>
					<else/>
					<form method="post" action="" name="form_data" id="form_data">
						<foreach name="list" val="vo">
							<tr class="tbody data_item">
								<if condition="$auth->admin">
									<td class="text-center col-3 checkbox">
									<input type="checkbox" name="id[]" value="{$vo.id}">
									</td>
								</if>
								<td>{$vo.month}</td>
								<td>{$vo.emp_no}</td>
								<php>
									$data=json_decode($vo['data']);
									foreach($data as $key=>$val){
									$html="<td>$val</td>";
									echo $html;
									}
								</php>
							</tr>
						</foreach>
					</form>
				</if>
			</table>
			<div class="pagination">
				{$page}
			</div>
		</div>
	</div>
</block>
<block name="js">
	<script type="text/javascript">
		layui.use(['global'], function() {
			var $ = layui.jquery;
			set_return_url(null);
			//保存后关闭
			$("#btn_del").on('click', function() {
				if ($("input[name='id[]']:checked").length == 0) {
					layer.msg('请选择要删除的项目');
					return false;
				}
				layer.msg('确定要删除吗?', {
					time : 0,
					btn : ['确定', '取消'],
					yes : function(index) {
						var vars = $("#form_data").serialize();
						send_ajax("{:url('del')}", vars, function(ret) {
							if (ret.status) {
								layer.msg(ret.info, function() {
									location.reload(true);
								});
							}
						});
					},
					no : function(index) {
						layer.close(index);
					}
				});
			});
		});
		function import_data() {
			window.open("{:url('import')}", "_self");
			return false;
		}

		function setpwd() {
			winopen("{:url('setpwd')}", 560, 470);
		}

		function header() {
			winopen("{:url('tabel_header')}", 560, 470);
		}
	</script>
</block>
